HF.hartree_fock

functions to perform a Hartree-Fock computation on the lattice

Functions

HF_energy(op1, op2, op3, dens)

Computes the Hartree-Fock energy for a given density dens and Hamiltonian consisting of one-body term op1, two-body term op2, and three-body term op3

HF_iter(op1, op2, op3, dens[, mix])

Performs one iteration of the Hartree-Fock procedure

contract_2nf(v2, dens)

takes list of two-body matrix elements and contracts them with the density to get a one-body operator

contract_3nf(w3, dens)

takes list of three-body matrix elements and contracts them with the density to get a one-body operator

get_1body_matrix(myTkin, nstat)

takes the list of one-body matrix elements and turns it into a square matrix

init_density(nstat, hole)

creates a density matrix of dimension nstat x nstat given the hole information

make_HF_ham(op1, op2, op3, dens)

takes Hamiltonian consisting of one-body operator op1, two-body operator op2, and three-body operator op3, and the density matrix and returns the Hartree-Fock Hamiltonian.

solve_HF(op1, op2, op3, dens[, mix, eps, ...])

Solve the Hartree-Fock problem

HF.hartree_fock.get_1body_matrix(myTkin, nstat)

takes the list of one-body matrix elements and turns it into a square matrix

Parameters:
  • nstat (int) – dimension of matrix, i.e. the number of 1-body states

  • myTkin (list[list[int,int, float]]) – list of one-body matrix elements [[p1,q1,value1], [p2,q2,value2], …]

Returns:

nstat x nstat matrix of the list of matrix elements

Return type:

numpy.array((:,:), dtype=float)

HF.hartree_fock.contract_2nf(v2, dens)

takes list of two-body matrix elements and contracts them with the density to get a one-body operator

Parameters:
  • v2 (list[list[int,int,int,int, float]]) – list of two-body matrix elements [p,q,r,s,value]

  • dens (numpy.array((:,:), dtype=float)) – square density matrix

Returns:

one-body operator of the same shape as the density matrix dens

Return type:

numpy.array((:,:), dtype=float)

HF.hartree_fock.contract_3nf(w3, dens)

takes list of three-body matrix elements and contracts them with the density to get a one-body operator

Parameters:
  • w3 (list[list[int,int,int,int,int,int, float]]) – list of two-body matrix elements [p,q,r,s,value]

  • dens (numpy.array((:,:), dtype=float)) – square density matrix

Returns:

one-body operator of the same shape as the density matrix dens

Return type:

numpy.array((:,:), dtype=float)

HF.hartree_fock.make_HF_ham(op1, op2, op3, dens)

takes Hamiltonian consisting of one-body operator op1, two-body operator op2, and three-body operator op3, and the density matrix and returns the Hartree-Fock Hamiltonian.

Parameters:
  • op1 (list[list[int,int, float]]) – list of one-body matrix elements

  • op2 (list[list[int,int,int,,int, float]]) – list of two-body matrix elements

  • op3 (list[list[int,int,int,int,int,int, float]]) – list of three-body matrix elements

  • dens (numpy.array((:,:), dtype=float)) – density matrix (same shape as op1)

Returns:

matrix in the shape of op1 and dens that is the Hartree-Fock Hamiltonian

Return type:

numpy.array((:,:), dtype=float)

HF.hartree_fock.init_density(nstat, hole)

creates a density matrix of dimension nstat x nstat given the hole information

Parameters:
  • nstat (int) – dimension of single-particle basis

  • hole (tuple(int, int, ... )) – tuple of occupied single-particle states, as numbers from 0 … A-1

Returns:

density matrix where hole states are occupied (1) and all others not (0)

Return type:

numpy.array((nstat,nstat), dtype = float)

HF.hartree_fock.HF_energy(op1, op2, op3, dens)

Computes the Hartree-Fock energy for a given density dens and Hamiltonian consisting of one-body term op1, two-body term op2, and three-body term op3

Parameters:
  • op1 (list[list[int,int, float]]) – list of one-body matrix elements

  • op2 (list[list[int,int,int,int, float]]) – list of two-body matrix elements

  • op3 (list[list[int,int,int,int,int,int, float]]) – list of three-body matrix elements

  • dens (numpy.array((:,:), dtype=float)) – density matrix (same shape as op1)

Returns:

Hartree-Fock energy

Return type:

float

HF.hartree_fock.HF_iter(op1, op2, op3, dens, mix=0.5)

Performs one iteration of the Hartree-Fock procedure

Parameters:
  • op1 (list[list[int,int, float]]) – list of one-body matrix elements

  • op2 (list[list[int,int,int,,int, float]]) – list of two-body matrix elements

  • op3 (list[list[int,int,int,int,int,int, float]]) – list of three-body matrix elements

  • dens (numpy.array((:,:), dtype=float)) – density matrix (same shape as op1)

  • mix (float) – returned density matrix is mix*new_density + (1-mix)*old_density

Returns:

energy, density, vecs as the current HF energy, current density matrix, and orthogonal transformation matrix that diagonalizes the HF Hamiltonian

Return type:

float, numpy.array((:,:), dtype=float), numpy.array((:,:), dtype=float)

HF.hartree_fock.solve_HF(op1, op2, op3, dens, mix=0.5, eps=1e-08, max_iter=100, verbose=False)

Solve the Hartree-Fock problem

Parameters:
  • op1 (list[list[int,int, float]]) – list of one-body matrix elements

  • op2 (list[list[int,int,int,,int, float]]) – list of two-body matrix elements

  • op3 (list[list[int,int,int,int,int,int, float]]) – list of three-body matrix elements

  • dens (numpy.array((:,:), dtype=float)) – density matrix (same shape as op1)

  • mix (float) – parameter used in the mixing: mix*new_density + (1-mix)*old_density

  • eps (float) – converegence of energy

  • max_iter (float) – maximum number of HF iterations

Returns:

energy, orthogonal transformation matrix that diagonalizes the HF Hamiltonian (the first A columns are occupied), converged

Return type:

float, numpy.array((:,:), dtype=float), boolean